<template>
  <div class="main-layout">
    <div class="main-top-lay">
      <Header style="flex:1;" :headHei='68' :title="systemTitle" :logo="logo" :user="userInfo"/>
    </div>
    <div class="left-main-content">
      <sidebar :menus="menus" :name="''" :active-menu="activeMenu" class="sidebar-container "/>
      <div class="main-container main-router-lay">
        <div class="main-router">
          <RouteView/>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import {useStore} from "@/stores";
import {computed, onMounted, ref, shallowRef} from "vue";

import Sidebar from './Sidebar/index.vue'
import Header from "@/components/common/PageHeader.vue";
import RouteView from "@/components/common/RouteWrap.vue";

const store = useStore();

const logo = ref(store.settings.logo);
const systemTitle = shallowRef(store.settings.title);

const activeMenu = ref(store.getHomeRoute());
const menus = ref<MenuType[]>(store.menus || []);

const userInfo = computed(() => {
  return store.getUser();
});

onMounted(() => {

})

</script>

<style scoped>
.main-layout {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-top-lay {
  width: 100%;
  display: flex;
  flex-direction: row;
}

.left-main-content {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  transition: margin-left .28s;
}

.main-router-lay {
  display: flex;
  flex-direction: column;
  flex: 1;
  background-color: #fff;
}

.main-router {
  flex: 1;
}

</style>
